﻿using System;
using System.Data.Entity;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace JustMVCTest.Models
{
    public class PO
    {
        [Required]
        [Key, Column(Order = 0)]
        [DisplayName("PO Number")]
	    public long PONumber  { get; set; }
        [Required]
        [Key, Column(Order = 1)]
        [DataType("Integer")]
        public int Item  { get; set; }
        [Required]
        [Key, Column(Order = 2)]
        [DisplayName("Update Num")]
        public int Update_Num  { get; set; }
        [Required]
        [DataType("Integer")]
        public int latest  { get; set; } // 0 - False, 1-True
        [Required]
        [DataType("Integer")]
        public int Status  { get; set; } // 0- Open, 1- Pending Close, 2- Pending Delivery Date, 99- Closed
        [Required]
        [DataType(DataType.Date)]
        [UIHint("Purchase_O")]
        [DisplayName("Purchase Open")]
        public DateTime Purchase_O { get; set; }
        [DataType(DataType.Date)]
        [UIHint("TSSC Send Date")]
        public DateTime TSSC_Pending_Send_Date { get; set; }
        [Required]
        [StringLength(20, ErrorMessage = "Length must be 20 chars or less")]
        public string Requisitioner  { get; set; }
        [DataType(DataType.Date)]
        [DisplayName("Delivery Date")]
        [UIHint("DeliveryDate")]
        public DateTime DeliveryDate  { get; set; }
        [DataType(DataType.Date)]
        [DisplayName("Delivery Date Req")]
        [UIHint("DeliveryDate_Req")]
        public DateTime DeliveryDate_Req  { get; set; }
        [Required]
        [StringLength(10, ErrorMessage = "Length must be 10 chars or less")]
        [DisplayName("Cost Center")]
        public string Cost_Cent  { get; set; }
        [StringLength(10, ErrorMessage = "Length must be 10 chars or less")]
        [DisplayName("Internal Order")]
        public string Int_Order  { get; set; }
        [Required]
        [StringLength(3, ErrorMessage = "Length must be 3 chars or less")]
        [DisplayName("Prof Center")]
        public string Prof_Cent  { get; set; }
        [Required]
        [DefaultValue(0)]
        [DisplayName("Percentage")]
        [DataType("Integer")]
        public int Percentage  { get; set; }
        [DataType(DataType.Date)]
        [DisplayName("Perc Update Date")]
        [UIHint("Percentage_Update_Date")]
        public DateTime Percentage_Update_Date { get; set; }
        [DataType("Integer")]
        [DisplayName("Cost Element")]
        public int cost_elem  { get; set; }
        [Required]
        [StringLength(25, ErrorMessage = "Length must be 25 chars or less")]
        [DisplayName("Co El Name")]
        public string co_el_name  { get; set; }
        [DataType("Integer")]
        public int Vendor { get; set; }
        [Required]
        [StringLength(35, ErrorMessage = "Length must be 35 chars or less")]
        public string VendorName  { get; set; }
        [Required]
        [StringLength(50, ErrorMessage = "Length must be 50 chars or less")]
        [DisplayName("Description")]
        public string Descr  { get; set; }
        [StringLength(5, ErrorMessage = "Length must be 2 chars or less")]
        public string UM  { get; set; }
        [Required]
        [StringLength(3, ErrorMessage = "Length must be 3 chars or less")]
        [DisplayName("T Currency")]
        public string T_Curr  { get; set; }
        [Required]
        [StringLength(5, ErrorMessage = "Length must be 5 chars or less")]
        [DisplayName("Sch Lin")]
        public string Sch_Lin  { get; set; }
        [Required]
        [DisplayName("Order Quantity")]
        public float Ord_Qty  { get; set; }
        [Required]
        [DisplayName("Open Quantity")]
        public float Open_Qty { get; set; }
        [Required]
        [DisplayName("Open Amount T")]
        public float Open_Amt_T { get; set; }
        [Required]
        [DisplayName("Order Amount")]
        public float Order_Amt { get; set; }
        [Required]
        [DisplayName("Open Amount L")]
        public float Open_Amt_L { get; set; }
        [Required]
        [DataType(DataType.Date)]
        [UIHint("Insert_Date")]
        [DisplayName("Insert Date")]
        public DateTime Insert_Date { get; set; }
        [Required]
        [DataType(DataType.Date)]
        [UIHint("Update_Date")]
        [DisplayName("Update Date")]
        public DateTime Update_Date { get; set; }
    }

    public partial class PODBContext : DbContext
    {
        public DbSet<PO> POs { get; set; }
    }
}